const _import = require('./_import_' + process.env.NODE_ENV)

import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    roles: ['admin','editor']     will control the page roles (you can set multiple roles)
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if true ,the page will no be cached(default is false)
  }
**/
import welcome from '@/views/welcome.vue';
import resourceCategory from '@/views/management/resourceCategory';
export const asyncRouterMap = [
  // 平台首页
  {
    path: '/home',
    component: Layout,
    redirect: '/home/index',
    meta: {
      title: '首页',
      icon: 'dashboard',
      noCache: true,
      interfaceName: '首页'
    },
    children: [{
        path: 'index',
        component: _import('home/index'),
        name: 'home',
        meta: {
          title: '首页',
          icon: 'dashboard',
          noCache: true,
          interfaceName: '首页'
        },
       },
      //  {
      //   path: 'index/map',
      //   component: _import('home/map'),
      //   name: 'map',
      //   meta: {
      //     title: '设备分布地图',
      //     icon: 'dashboard',
      //     noCache: true,
      //     interfaceName: '设备分布地图'
      //   },
      //  }
    ]
  },
  // 用户管理
  {
    path: '/back/user/',
    component: Layout,
    redirect: 'user',
    alwaysShow: true,
    meta: {
      title: '用户管理',
      icon: 'people',
      noCache: true,
      interfaceName: '用户管理'
    },
    children: [{
        path: 'user_list',
        component: _import('user/list'),
        name: 'user_list',
        meta: {
          title: '用户列表',
          icon: 'people',
          noCache: true,
          interfaceName: '用户列表'
        }
      },

      {
        path: 'user_cardList',
        component: _import('user/cardList'),
        name: 'user_cardList',
        meta: {
          title: '用户月卡列表',
          icon: 'people',
          noCache: true,
          interfaceName: '用户月卡列表'
        }
      },
    ],

  },
   //代理商管理
   {
    path: '/back/adminEnt/',
    component: Layout,
    redirect: 'adminEnt',
    alwaysShow: true,
    meta: {
      title: '代理商管理',
      icon: 'user',
      noCache: true,
      interfaceName: '代理商管理'
    },
    children: [{
        path: 'getBackAgentList',
        component: _import('adminEnt/list'),
        name: 'adminEnt_list',
        meta: {
          title: '代理商列表',
          icon: 'user',
          noCache: true,
          interfaceName: '代理商列表'
        }
      }
    ]
  },
 // 管理员管理
 {
  path: '/management',
  component: Layout,
  redirect: '/management/role',
  alwaysShow: true,
  meta: {
    title: '权限管理',
    icon: 'ums',
    noCache: true,
    interfaceName: '权限管理'
  },
  children: [{
      path: 'role',
      component: _import('management/role'),
      name: 'management_role',
      meta: {
        title: '角色管理',
        icon: 'ums'
      }
    },
    {
      path: 'menu',
      component: _import('management/menu'),
      name: 'management_menu',
      meta: {
        title: '菜单管理',
        icon: 'ums'
      }
    },
    {
      path: 'resource',
      component: _import('management/resource'),
      name: 'management_resource',
      meta: {
        title: '资源管理',
        icon: 'ums'
      }
    },
    // {
    //   path: 'resource',
    //   component: _import('management/managerList'),
    //   name: 'management_managerList',
    //   meta: {
    //     title: '管理员列表',
    //     icon: 'ums'
    //   }
    // },
    // {
    //   path: 'resourceCategory',
    //   component: _import('management/resourceCategory'),
    //   name: 'management_resourceCategory',
    //   meta: { title: '资源分类', icon: 'management' }
    // },
  ]
},



  //设备管理
  {
    path: '/equipment',
    component: Layout,
    redirect: 'equipment',
    alwaysShow: true,
    meta: {
      title: '设备管理',
      icon: 'equipment',
      noCache: true,
      interfaceName: '设备管理'
    },
    children: [{
        path: 'list',
        component: _import('equipment/list'),
        name: 'equipment_list',
        meta: {
          title: '设备列表',
          icon: 'equipment',
          noCache: true,
          interfaceName: '设备列表'
        }
      },
      {
        path: 'defaultMeal',
        component: _import('equipment/defaultMeal'),
        name: 'equipment_defaultMeal',
        meta: {
          title: '设备默认套餐',
          icon: 'equipment',
          noCache: true,
          interfaceName: '设备默认套餐'
        }
      },
      {
        path: 'monthlyRentList',
        component: _import('equipment/monthlyRentList'),
        name: 'equipment_monthlyRentList',
        meta: {
          title: '月租列表',
          icon: 'equipment',
          noCache: true,
          interfaceName: '月租列表'
        }
      },
      {
        path: 'equipmentDate',
        hidden: true,
        component: _import('equipment/equipmentDate'),
        name: 'equipment_equipmentDate',
        meta: {
           title: '设备详情', 
           noCache: true,
           icon: 'guide',
           interfaceName: '设备详情'
          }
       },
      {
        path: 'equipmentCard',
        hidden: true,
        component: _import('equipment/equipmentCard'),
        name: 'equipment_equipmentCard',
        meta: {
           title: '设备卡套餐', 
           noCache: true,
           icon: 'guide',
           interfaceName: '套餐详情'
          }
       },
      {
        path: 'equipmentEleDate',
        hidden: true,
        component: _import('equipment/equipmentEleDate'),
        name: 'equipment_equipmentEleDate',
        meta: {
           title: '设备月用电量', 
           noCache: true,
           icon: 'guide',
           interfaceName: '设备月用电量'
          }
       },
    ]
  },
 {
  path: '/electricQuantity/',
  component: Layout,
  redirect: 'electricQuantity',
  alwaysShow: true,
  meta: {
    title: '电量消耗管理',
    icon: 'tab',
    noCache: true,
    interfaceName: '电量消耗管理',
  },
  children: [{
      path: 'list',
      component: _import('electricQuantity/list'),
      name: 'electricQuantity_list',
      meta: {
        title: '电量消耗列表',
        icon: 'tab',
        noCache: true,
        interfaceName: '电量消耗列表'
      }
    },
    {
      path: 'mouthList',
      component: _import('electricQuantity/mouthList'),
      name: 'electricQuantity_mouthList',
      meta: {
        title: '月电量消耗列表',
        icon: 'tab',
        noCache: true,
        interfaceName: '月电量消耗列表'
      }
    }
  ]
},
  //设备订单管理
  {
    path: '/equipmentOrders',
    component: Layout,
    redirect: 'equipmentOrders',
    alwaysShow: true,
    meta: {
      title: '订单管理',
      icon: 'order',
      noCache: true,
      interfaceName: '订单管理'
    },
    children: [
      {
        path: 'list',
        component: _import('equipmentOrders/list'),
        name: 'equipmentOrders_list',
        meta: {
          title: '充电订单列表',
          icon: 'order',
          noCache: true,
          interfaceName: '充电订单列表'
        }
      },
   
      {
        path: 'orderDate',
        hidden: true,
        component: _import('equipmentOrders/orderDate'),
        name: 'equipmentOrders_orderDate',
        meta: { title: '订单详情', noCache: true, icon: 'guide' }
       },
      {
        path: 'listCard',
        component: _import('equipmentOrders/listCard'),
        name: 'equipmentOrders_listCard',
        meta: {
          title: '月卡订单列表',
          icon: 'order',
          noCache: true,
          interfaceName: '月卡订单列表'
        }
      },
      // {
      //   path: 'listOrderIcCard',
      //   component: _import('equipmentOrders/listOrderIcCard'),
      //   name: 'equipmentOrders_orderIcCard',
      //   meta: {
      //     title: 'Ic卡订单列表',
      //     icon: 'order',
      //     noCache: true,
      //     interfaceName: 'Ic卡订单列表'
      //   }
      // },
      
      {
        path: 'listOrderRecharge',
        component: _import('equipmentOrders/listOrderRecharge'),
        name: 'equipmentOrders_orderRecharge',
        meta: {
          title: '充值订单列表',
          icon: 'order',
          noCache: true,
          interfaceName: '充值订单列表'
        }
      },

      
    ]
  },
 // 财务中心
  {
    path: '/financial',
    component: Layout,
    redirect: 'financial',
    alwaysShow: true,
    meta: {
      title: '财务中心',  
      icon: 'financial',
      noCache: true,
      interfaceName: '财务中心'
    },
    children: [
      {
        path: 'financeUser',
        component: _import('financial/financeUser'),
        name: 'financial_financeUser',
        meta: {
          title: '用户财务',
          icon: 'order',
          noCache: true,
          interfaceName: '用户财务'
        },
      },
      {
        path: 'equipmentFinance',
        component: _import('financial/equipmentFinance'),
        name: 'financial_equipmentFinance',
        meta: {
          title: '设备财务',
          icon: 'documentation',
          noCache: true,
          interfaceName: '设备财务'
        },
      },
      // {
      //   path: 'refundReview',
      //   component: _import('financial/refundReview'),
      //   name: 'refundReview',
      //   meta: {
      //     title: '退款审核列表',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '退款审核列表'
      //   },
      // },



      // equipmentFinance
      // {
      //   path: 'financeAgent',
      //   component: _import('financial/financeAgent'),
      //   name: 'financial_financeAgent',
      //   meta: {
      //     title: '代理商财务',
      //     icon: 'order',
      //     noCache: true,
      //     interfaceName: '代理商财务'
      //   }
      // },
    ]
  },

  // 数据统计
  // {
  //   path: '/dataAnalysis',
  //   component: Layout,
  //   redirect: 'dataAnalysis',
  //   alwaysShow: true,
  //   meta: {
  //     title: '数据统计',  
  //     icon: 'financial',
  //     noCache: true,
  //     interfaceName: '数据统计'
  //   },
  //   children: [
  //     {
  //       path: 'dataAnalysis',
  //       component: _import('dataAnalysis/index'),
  //       name: 'dataAnalysis_index',
  //       meta: {
  //         title: '数据统计',
  //         icon: 'order',
  //         noCache: true,
  //         interfaceName: '数据统计'
  //       }
  //     },
  //   ]
  // },


  {
    path: '/recharge',
    component: Layout,
    redirect: 'user',
    alwaysShow: true,
    meta: {
      title: '充值套餐管理',
      icon: 'peoples',
      noCache: true,
      interfaceName: '充值套餐管理'
    },
    children: [{
        path: 'list',
        component: _import('recharge/list'),
        name: 'recharge_list',
        meta: {
          title: '充值套餐',
          icon: 'peoples',
          noCache: true,
          interfaceName: '充值套餐'
        }
      }
    ]
  },
  {
    path: '/cardType/',
    component: Layout,
    redirect: 'cardType',
    alwaysShow: true,
    meta: {
      title: '城市月卡管理',
      icon: 'example',
      noCache: true,
      interfaceName: '城市月卡管理',
      roles: [1,2]
    },
    children: [{
        path: 'list',
        component: _import('cardType/list'),
        name: 'cardType_list',
        meta: {
          title: '城市月卡列表',
          icon: 'example',
          noCache: true,
          interfaceName: '城市月卡列表'
        }
      }
    ]
  },
 
  {
    path: '/icCard',
    component: Layout,
    redirect: 'user',
    alwaysShow: true,
    meta: {
      title: 'IC卡管理',
      icon: 'card',
      noCache: true,
      interfaceName: 'IC卡管理'
    },
    children: [{
        path: 'list',
        component: _import('icCard/list'),
        name: 'icCard_list',
        meta: {
          title: 'IC卡管理',
          icon: 'card',
          noCache: true,
          interfaceName: 'IC卡管理'
        }
      }
    ]
  },
  // 意见反馈管理
  // {
  //   path: '/feedback',
  //   component: Layout,
  //   redirect: '/feedback/list',
  //   alwaysShow: true,
  //   meta: {
  //     title: '意见反馈管理',
  //     icon: 'jurisdiction',
  //     noCache: true,
  //     interfaceName: '意见反馈管理'
  //   },
  //   children: [{
  //     path: 'list',
  //     component: _import('feedback/list'),
  //     name: 'feedback-list',
  //     meta: {
  //       title: '反馈列表',
  //       icon: 'jurisdiction',
  //       noCache: true,
  //       interfaceName: '反馈列表'
  //     }
  //   },{
  //     path: 'detail',
  //     component: _import('feedback/detail'),
  //     name: 'feedback-detail',
  //     hidden: true,
  //     meta: {
  //       title: '反馈详情',
  //       icon: 'jurisdiction',
  //       noCache: true,
  //       interfaceName: '查看'
  //     }
  //   } ]
  // },
  // 系统设置
  {
    path: '/system',
    component: Layout,
    redirect: 'system/tutorial',
    alwaysShow: true,
    meta: {
      title: '系统参数设置',
      icon: 'system',
      interfaceName: '获取系统参数'
    },
    children: [
      {
        path: 'public',
        component: _import('system/public'),
        name: 'system_public',
        meta: {
          title: '公共参数',
          icon: 'system',
          noCache: true,
          interfaceName: '获取系统参数'
        },
      },
      {
        path: 'advertiseIndex',
        component: _import('system/advertiseIndex'),
        name: 'system_advertiseIndex',
        meta: {
          title: '广告轮播图',
          icon: 'system',
          noCache: true,
          interfaceName: '获取系统参数'
        },
      },
      {
        path: 'phoneNumList',
        component: _import('system/phoneNumList'),
        name: 'system_phoneNumList',
        meta: {
          title: '服务电话列表',
          icon: 'system',
          noCache: true,
          interfaceName: '服务电话列表'
        },
      },
      // {
      //   path: 'service',
      //   component: _import('system/service'),
      //   name: 'system_service',
      //   meta: {
      //     title: '服务条款',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '获取系统参数'
      //   },
      // },
      // {
      //   path: 'phoneList',
      //   component: _import('system/aboutus'),
      //   name: 'system_aboutus',
      //   meta: {
      //     title: '关于我们',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '获取系统参数'
      //   },
      //   path: 'company',
      //   component: _import('system/company'),
      //   name: 'system_company',
      //   meta: {
      //     title: '公司简介',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '获取系统参数'
        
      //   },
      // },
      // {
      //   path: 'aboutus',
      //   component: _import('system/aboutus'),
      //   name: 'system_aboutus',
      //   meta: {
      //     title: '关于我们',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '获取系统参数'
      //   },
      //   path: 'company',
      //   component: _import('system/company'),
      //   name: 'system_company',
      //   meta: {
      //     title: '公司简介',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '获取系统参数'
      //   },
      // },
      // {
      //   path: 'directions',
      //   component: _import('system/directions'),
      //   name: 'system_directions',
      //   meta: {
      //     title: '使用说明',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '获取系统参数'
      //   },
      // },
      // {
      //   path: 'recordType',
      //   component: _import('system/recordType'),
      //   name: 'system_recordType',
      //   meta: {
      //     title: '问题类型设置',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '获取系统参数'
      //   },
      // },
      
      // {
      //   path: 'joinIndex',
      //   component: _import('system/joinIndex'),
      //   name: 'system_joinIndex',
      //   meta: {
      //     title: '加盟轮播图',
      //     icon: 'system',
      //     noCache: true,
      //     interfaceName: '获取系统参数'
      //   },
      // },
    ]
  },
  {
    path: '/interfaceManagement',
    component: Layout,
    redirect: 'user',
    alwaysShow: true,
    meta: {
      title: '接口管理',
      icon: 'interface',
      noCache: true,
      interfaceName: '接口管理'
    },
    children: [{
        path: 'pushField',
        component: _import('interfaceManagement/pushField'),
        name: 'pushField',
        meta: {
          title: '推送字段',
          icon: 'example',
          noCache: true,
          interfaceName: '推送字段'
        }
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

export const constantRouterMap = [{
    path: '/welcome',
    component: Layout,
    redirect: '/welcome/index',
    children: [{
      path: 'index',
      component: welcome,
      name: 'welcome',
      meta: {
        title: '欢迎页',
        icon: 'dashboard',
        noCache: true
      }
    }]
  },
  {
    path: '/resourceCategory',
    component: Layout,
    children: [{
      path: 'resourceCategory',
      component: resourceCategory,
      name: 'resourceCategory',
      meta: {
        title: '资源分类',
        icon: 'management',
        noCache: true
      }
    }]
  },
  {
    path: '/',
    redirect: '/login',
    hidden: true
  },
  {
    path: '/login',
    name: 'login',
    component: _import('login/index'),
    hidden: true
  },
  {
    path: '/404',
    name: '404',
    component: _import('errorPage/404'),
    hidden: true
  },
  {
    path: '/401',
    name: '401',
    component: _import('errorPage/401'),
    hidden: true
  },
]

export const constUrl = [
  ...asyncRouterMap,
  ...constantRouterMap
]
